""" 
请写出一段 Python 代码实现分组一个 list 里面的元素
比如 [1,2,3,...100] 变成 [[1,2,3],[4,5,6]....[100]]
需要将列表中三个元素一组分隔，剩下的最后一组，其实就是对列表进行切片操作
"""

# 创建列表
lst = [ele for ele in range(1, 101)]

newl = [lst[ele:ele+3] for ele in range(0, len(lst), 3)]

print(newl)

# 创建列表
lst = [ele for ele in range(1, 101)]

# 切片 0:3  3:6 6:9
newL = [lst[ele:ele + 3] for ele in range(0, len(lst)) if ele % 3 == 0]
print(newL)